home *** CD-ROM | disk | FTP | other *** search
/ MacWarehouse Macintosh Games / MacWarehouse Macintosh Games.iso / AMBER demo / AMBER-Journeys Beyond™ Patch 1c / 00105_generic domain rules.ls < prev    next >
Encoding:
Text File  |  1997-02-19  |  8.6 KB  |  315 lines

  1. on cursorOff
  2.   global colorcrsr, YugoCursors, gCursorSwitch
  3.   if objectp(colorcrsr) then
  4.     colorcrsr(mGetSetCursor, getProp(YugoCursors, #noCursor))
  5.     set gCursorSwitch to #off
  6.   else
  7.     cursor(200)
  8.     set gCursorSwitch to #off
  9.   end if
  10. end
  11.  
  12. on cursorOn
  13.   global colorcrsr, YugoCursors, thisCursor, gCursorSwitch
  14.   if gCursorSwitch = #off then
  15.     if objectp(colorcrsr) then
  16.       colorcrsr(mGetSetCursor, getProp(YugoCursors, thisCursor))
  17.     else
  18.       castCursor(getProp(YugoCursors, thisCursor))
  19.     end if
  20.     set gCursorSwitch to #on
  21.   end if
  22. end
  23.  
  24. on castCursor cursorID
  25.   set myCursorOffset to 1400
  26.   if integerp(cursorID) then
  27.     set whichCursor to cursorID - 6000
  28.   else
  29.     put "castCursor(): wow, a cursor label: "
  30.     put cursorID
  31.     exit
  32.   end if
  33.   set cMask to myCursorOffset + (whichCursor * 2)
  34.   cursor([cMask - 1, cMask])
  35. end
  36.  
  37. on killVideo
  38.   global lastScoreSprite
  39.   set vidSprite to 44
  40.   set the movieRate of sprite vidSprite to 0
  41.   set the locV of sprite vidSprite to -500
  42.   updateStage()
  43.   set the castNum of sprite vidSprite to 7
  44.   puppetSprite(vidSprite, 0)
  45. end
  46.  
  47. on pushVideo
  48.   set vidSprite to 44
  49.   set the movieTime of sprite 44 to 0
  50.   updateStage()
  51.   set the movieRate of sprite 44 to 1
  52. end
  53.  
  54. on setCurrentLocation suggestion
  55.   return "Use the goTo() function instead.."
  56. end
  57.  
  58. on goTo destination, transition
  59.   global oPuppeteer, oStoryteller, builderWindow, gPreloading, gScanFinish, colorcrsr, YugoCursors, thisCursor, gCursorSwitch, gPeekAlertEnabled
  60.   report(">starting 'goTo()'  (" & the timer & " ticks after mouseDown)")
  61.   if objectp(colorcrsr) then
  62.     colorcrsr(mGetSetCursor, getProp(YugoCursors, #noCursor))
  63.   else
  64.     cursor(200)
  65.   end if
  66.   set gCursorSwitch to #off
  67.   if (destination = #destination) or (transition = #transition) then
  68.     exit
  69.   end if
  70.   report(">cursorOff done (" & the timer & " ticks)")
  71.   setAt(getProp(the lsStateData of oStoryteller, #previousLocation), 1, getAt(getProp(the lsStateData of oStoryteller, #currentLocation), 1))
  72.   setAt(getProp(the lsStateData of oStoryteller, #currentLocation), 1, destination)
  73.   if the castNum of sprite 44 <> 7 then
  74.     killVideo()
  75.     moveMovies(oPuppeteer)
  76.   end if
  77.   setTransition(oPuppeteer, transition)
  78.   report(">'setTransition()' done (" & the timer & " ticks)")
  79.   moveToLocation(oPuppeteer)
  80.   report(">'moveToLocation()' done (" & the timer & " ticks)")
  81.   if getPos(the windowList, builderWindow) then
  82.     tell builderWindow
  83.       refreshCast()
  84.       refreshHotspots()
  85.     end tell
  86.   end if
  87.   if gPreloading = 1 then
  88.     preloadLocations()
  89.     report(">preLoadLocations done (" & the timer & " ticks)")
  90.   else
  91.     report(">preLoadLocations skipped (" & the timer & " ticks)")
  92.   end if
  93.   report(" Available memory: " & the freeBytes / 1024 & " K (incl. " & the freeBlock / 1024 & " K block)")
  94.   report("   :")
  95.   set lsMoveCounter to getProp(the lsStateData of oStoryteller, #moveCount)
  96.   set oldCount to getAt(lsMoveCounter, 1)
  97.   setAt(lsMoveCounter, 1, oldCount + 1)
  98.   return #OK
  99. end
  100.  
  101. on goBack
  102.   global oStoryteller
  103.   goTo(getState(oStoryteller, #previousLocation), #backOff)
  104. end
  105.  
  106. on idle
  107.   global lastCursor, thisCursor, cursorOffset, castCursorList, maxCursor, oStoryteller, oPuppeteer, gCurrentHotspot, gItemInUse, domainIsReady, gPreloading, gStopTransitions, g16bit, gTransQuality, gFreezeInventory, gSoundPath, gOriginPoint, gMenuBottomY, gGammaLevel, gDeferredTransit
  108.   if gDeferredTransit = #none then
  109.     if domainIsReady then
  110.       cursorOn()
  111.       set thisCursor to #pointer
  112.       set gCurrentHotspot to #none
  113.       if the mouseV < gMenuBottomY then
  114.         if the number of menus = 0 then
  115.           installMenu(the number of cast "Amber menus")
  116.           if gTransQuality = #none then
  117.             set the checkMark of menuItem 1 of menu 3 to 1
  118.           end if
  119.           if gTransQuality = #Better then
  120.             set the checkMark of menuItem 2 of menu 3 to 1
  121.           end if
  122.           if gTransQuality = #Best then
  123.             set the checkMark of menuItem 3 of menu 3 to 1
  124.           end if
  125.           set the checkMark of menuItem (8 - the soundLevel) of menu 2 to 1
  126.           if gGammaLevel <> "unknown" then
  127.             set the checkMark of menuItem (8 - gGammaLevel) of menu 4 to 1
  128.           end if
  129.           set thisCursor to #pointer
  130.         end if
  131.       else
  132.         installMenu(0)
  133.       end if
  134.       set mouseLoc to point(the mouseH, the mouseV) - gOriginPoint
  135.       repeat with i in the lsLiveHotspots of oPuppeteer
  136.         if inside(mouseLoc, getAt(i, 2)) then
  137.           set myCursor to getAt(i, 1)
  138.           if myCursor = #itemInUse then
  139.             set thisCursor to getState(oStoryteller, #itemInUse)
  140.           else
  141.             set thisCursor to myCursor
  142.           end if
  143.           set gCurrentHotspot to i
  144.           exit repeat
  145.         end if
  146.       end repeat
  147.       prodVLoops()
  148.       if thisCursor <> lastCursor then
  149.         cursorDance(value(lastCursor & "To" & thisCursor))
  150.         set lastCursor to thisCursor
  151.       end if
  152.     end if
  153.   else
  154.     do(gDeferredTransit)
  155.     if gDeferredTransit contains "waiting" then
  156.       if domainIsReady = 1 then
  157.         if getState(oStoryteller, #currentDomain) = the last word in gDeferredTransit then
  158.           set gDeferredTransit to #none
  159.         end if
  160.       end if
  161.     end if
  162.   end if
  163. end
  164.  
  165. on cursorDance cursorList
  166.   global colorcrsr, thisCursor, YugoCursors, gCPU
  167.   if gCPU <> #PC then
  168.     if not objectp(colorcrsr) then
  169.       cursor(-1)
  170.       set colorcrsr to ColorCursor(mnew)
  171.     end if
  172.   end if
  173.   if not listp(cursorList) then
  174.     if objectp(colorcrsr) then
  175.       colorcrsr(mGetSetCursor, getProp(YugoCursors, thisCursor))
  176.     else
  177.       castCursor(getProp(YugoCursors, thisCursor))
  178.     end if
  179.     exit
  180.   end if
  181.   set flipBook to cursorList
  182.   if objectp(colorcrsr) then
  183.     repeat with flipper = 1 to count(flipBook)
  184.       startTimer()
  185.       colorcrsr(mGetSetCursor, getAt(flipBook, flipper))
  186.       repeat while 2 > the timer
  187.         nothing()
  188.       end repeat
  189.     end repeat
  190.   else
  191.     repeat with flipper = 1 to count(flipBook)
  192.       startTimer()
  193.       castCursor(getAt(flipBook, flipper))
  194.       repeat while 2 > the timer
  195.         nothing()
  196.       end repeat
  197.     end repeat
  198.   end if
  199. end
  200.  
  201. on inState stateVar, whichItem
  202.   global oStoryteller
  203.   set statelist to getProp(the lsStateData of oStoryteller, stateVar)
  204.   return getPos(statelist, whichItem)
  205. end
  206.  
  207. on trimState stateVar, whichItem
  208.   global oStoryteller
  209.   set statelist to getProp(the lsStateData of oStoryteller, stateVar)
  210.   set myPos to getPos(statelist, whichItem)
  211.   if myPos then
  212.     deleteAt(statelist, myPos)
  213.   end if
  214. end
  215.  
  216. on addState stateVar, whichItem
  217.   global oStoryteller
  218.   set statelist to getProp(the lsStateData of oStoryteller, stateVar)
  219.   set myPos to getPos(statelist, whichItem)
  220.   if not myPos then
  221.     append(statelist, whichItem)
  222.   end if
  223. end
  224.  
  225. on patchPalette
  226.   global oFixPal
  227.   oFixPal(mPatchIt)
  228. end
  229.  
  230. on forcePalette palName
  231.   global oPuppeteer, gCurrentPalette
  232.   puppetPalette(palName, 60)
  233.   set gCurrentPalette to #changeMe
  234.   patchPalette()
  235. end
  236.  
  237. on loadMultiFrames whichOnes
  238.   global oPuppeteer
  239.   set theFrames to getaProp(the lsMultiFrames of oPuppeteer, whichOnes)
  240.   if listp(theFrames) then
  241.     repeat with i in theFrames
  242.       preLoadCast(i)
  243.     end repeat
  244.   else
  245.     alert("Hey! There's no such list in lsMultiframes!")
  246.   end if
  247. end
  248.  
  249. on purgeMultiframes whichOnes
  250.   global oPuppeteer
  251.   set theFrames to getaProp(the lsMultiFrames of oPuppeteer, whichOnes)
  252.   if listp(theFrames) then
  253.     repeat with i in theFrames
  254.       unLoadCast(i)
  255.     end repeat
  256.   else
  257.     alert("Hey! There's no such list in lsMultiframes!")
  258.   end if
  259. end
  260.  
  261. on disablePeekAlert
  262.   nothing()
  263. end
  264.  
  265. on enablePeekAlert
  266.   nothing()
  267. end
  268.  
  269. on gammaFade upOrDown, howFast
  270.   global gCPU
  271.   if gCPU = #PC then
  272.     exit
  273.   end if
  274.   set speedCodes to [#glacial: "4", #slow: "18", #fast: "36", #instant: "100"]
  275.   set mySpeed to getaProp(speedCodes, howFast)
  276.   if voidp(mySpeed) then
  277.     set mySpeed to getProp(speedCodes, #fast)
  278.   end if
  279.   if upOrDown = #down then
  280.     MonitorFade("down", mySpeed)
  281.   else
  282.     updateStage()
  283.     MonitorFade("up", mySpeed)
  284.   end if
  285. end
  286.  
  287. on setColor howManybits
  288.   set the colorDepth to howManybits
  289.   if the colorDepth <> howManybits then
  290.     if howManybits = 16 then
  291.       set the colorDepth to 32
  292.     else
  293.       put "Sorry, Director sez the colorDepth is " & the colorDepth & " bits.."
  294.     end if
  295.   else
  296.   end if
  297. end
  298.  
  299. on fadeToMontage whichNumber
  300.   global oStoryteller, oPuppeteer
  301.   setState(oStoryteller, #showMontage, whichNumber)
  302.   setTransition(oPuppeteer, #fadeIn)
  303.   updateDisplay(oPuppeteer)
  304. end
  305.  
  306. on fadeOutTransit
  307.   repeat with fadeFactor = 30.0 down to 0.0
  308.     repeat with i = 1 to 4
  309.       set the volume of sound i to float(the volume of sound i) * (fadeFactor / 30.0)
  310.     end repeat
  311.     wait(8)
  312.     updateStage()
  313.   end repeat
  314. end
  315.